//
//  UINavigationController+ZCLeaks.m
//  Pods-ZCXiaoXinFenCategory_Example
//
//  Created by 张葱 on 2019/11/7.
//

#import "UINavigationController+ZCLeaks.h"
#import "NSObject+ZCLeaks.h"
#import <objc/runtime.h>
extern const void* const kLGHasBeenPoppedKey;
@implementation UINavigationController (ZCLeaks)
+(void)load{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
         [self lg_hookOrigInstanceMenthod:@selector(popViewControllerAnimated:) newInstanceMenthod:@selector(lg_popViewControllerAnimated:)];
    });
}

- (UIViewController *)lg_popViewControllerAnimated:(BOOL)animated{
    UIViewController *popView = [self lg_popViewControllerAnimated:animated];
    objc_setAssociatedObject(popView, kLGHasBeenPoppedKey, @(YES), OBJC_ASSOCIATION_RETAIN);
    return popView;
}
@end
